(function (fruit, util, global,dom) {

    fruit.define("fruit.ui.HTMLParser", {
        singleton:true,
        properties:{
        },
        methods:{
            processor:[],
            registerProcessor:function (opts) {
                this.processor.push(opts);
            },
            parse:function(el){
                if (dom.isElement(el)) {
                    this.process(el);
                    var child = el.firstChild;
                    while (child) {
                        this.parse(child);
                        child = child.nextSibling;
                    }
                }
            },
            process:function(el){
                util.each(this.processor,function(opts){
                    if(opts.selector.call(this,el)){
                        opts.handler.call(this,el);
                    }
                });
            }
        }
    });
})(fruit, fruit.util, fruit.global,fruit.dom);